<?php $this->load->view("general/header");?>



<script src="<?php echo base_url();?>js/hitung.js"></script>
  <div id="dialog-form-barang" title="Pilih Barang">
        	<select name="jenisBarang" id="jenisBarang" onchange="javascript:invoJenisBarang1(
                                                        '#jenisBarang', '#tempatBarang', '0')">
                	<option value="" disabled="disabled" selected="selected">::: Select :::</option>
                    <option value="supir">Supir</option>
                    <option value="mobil">Mobil</option>
                    </select>
            <form>
            <fieldset>
            
            	<div id="suksesAdd"></div>
            	<div id="tempatBarang">
                	
                </div>
            </fieldset>
            </form>
</div> 
<div id="create_invoice" class="page_">
    <div class="form">              
        <div class="form_header">Buat Invoice</div>
        
        
        <div class="content_dataZ">
      
        <strong>Tambah dari Sales Order :</strong> <input type="text" name="dariSO" id="dariSO" style="background-color:#FFFF99"/> <a href="<?php echo site_url("invoice/add_invoice_bySO");?>" id="baseUrl" class="LinkButton">Tambahkan</a>
        <form method="post" action="<?php echo site_url("invoice/add_invoice");?>">
        	
                
            <table id="invoadd">
            	
            	<tr>
                	<td colspan="6" width="50%"><strong>General Info</strong></td>
                    <td colspan="6" width="50%"><strong>Customer & Order Info</strong></td>
                </tr>
                <tr >
                	<td id="subcontentf">Kode:</td>
                    <td><input type="text" disabled="disabled" id="noInvoice" name="noInvoiceR"
                    	value="<?php if((isset($max1))){
					 					echo $max1;
				 					 }
						 			 else{echo $max;}?>" />
                                     <input type="text" id="noInvoTambah"  name="noInvoiceRTmbah"
                                     style="display:none"
                    	value="<?php echo $invoTambah['1']?>" />
                    </td>
                    <td id="subcontents">Staff Input:</td>
            		<td><input type="text" disabled="disabled"
                    	value="<?php echo get_username($this->session->userdata("user_id"));?>" />
                    </td>
                     <td>
                    	
                    </td>
                    <td>
                    	
                    </td>
                    
                    <td id="subcontentf">Pilih PT:</td>
                    <td>
                    	<select   id="pt" name="ptName" onchange="javascript:invoViewCustomerPt(
                                                        '#pt', '#content_datax', '0')"  style="width: 300px">
                            <option value="" selected="selected">::: Select :::</option>
                            <option value="0">Perorangan</option>
                            <?php foreach ($perusahaan as $perusahaan1){?>
                                <option value="<?php echo $perusahaan1['pt_id'];?>"><?php echo $perusahaan1['pt_name'];?></option>
                            <?php }?>
                        </select>
                       <!-- <select   id="pt" name="ptName" onchange="javascript:updateNoInvo(this.form)" >
                            <option value="" selected="selected">::: Select :::</option>
                            <option value="0">Perorangan</option>
                            <?php /*foreach ($perusahaan as $perusahaan1){*/?>
                                <option value="<?php /*echo $perusahaan1['pt_id'];?>"><?php echo $perusahaan1['pt_name'];*/?></option>
                            <?php /*}*/?>
                        </select>-->
                    </td>
                    <td>Pilih Customer:</td>
                    <td>
                    	<div id="content_datax">
                        	<select  id="customer" name="customer" >
                                <option value="" selected="selected">::: Select :::</option>
                                
                        	</select>
                        </div>
                    </td>
                    <td>
                    	<img src="<?php echo base_url();?>image_tinymce/add.jpg" id="refreshimgC"/>
                    </td>
                   
            	</tr>
                <tr>
                	<td id="subcontentf">Mata Uang:</td>
                    <td colspan="3"><input type="text" value="IDR" name="mataUang"/></td>
                    <td></td>
                    <td></td>
                    <td id="subcontentf">Order No.:</td>
                    <td colspan="3"><input type="text" name="order"/></td>
                    <td></td>
                </tr> 
                <tr>
                	<td id="subcontentf">Tanggal:</td>
                    <td><input type="text" value="<?php echo date("d-M-Y");?>" class="txtdate2" name="dateNow" id="datenow" onchange="javascript:AddDays(14)"/></td>
                    
                    <td>Due by:</td>
                    <td><div id="datedue"></div> <input type="text" value="<?php echo date("d-M-Y");?>" class="txtdate2" name="dateDue" id="datedue1"/></td>
                    <td></td>
                    <td></td>
                    <td id="subcontentf">Sales Person:</td>
                    <td colspan="3" id="salesPlace"><select name="salesPerson">
                         
                         <?php foreach ($staff as $staff1){?>
                                        <option value="<?php echo $staff1['user_id'];?>"><?php echo $staff1['name'];?></option>
                                    <?php }?>	
                     </select></td>
                     <td>
                    	<img src="<?php echo base_url();?>image_tinymce/add.jpg" id="refreshimgSales"/>
                    </td>
                    
                </tr>
                <tr>
                	<td colspan="6" width="50%"><strong>Delivery Info</strong></td>
                    <td colspan="6" width="50%"><strong>Payment Info</strong></td>
                </tr>
                <tr>
                	<td id="subcontentf">Delivery To:</td>
                    <td colspan="4">
                    	<div id="content_deliv">
                        	<select  id="shipto" name="shipto" >
                                <option value="" selected="selected">::: Select :::</option>
                                
                        	</select>
                        </div>
                    </td>
                    <td>
                    	<img src="<?php echo base_url();?>image_tinymce/add.jpg" id="refreshimgD"/>
                    </td>
                    
                    <td id="subcontentf">Bill To:</td>
                    <td colspan="3">
                    	<div id="content_bill">
                        	<select  id="billto" name="billto" >
                                <option value="" selected="selected">::: Select :::</option>
                                
                        	</select>
                        </div>	
                    </td>
                    <td>
                    	<img src="<?php echo base_url();?>image_tinymce/add.jpg" id="refreshimgB"/>
                    </td>
                    
                
                </tr>
                <tr>
                	<td id="subcontentf">Delivery Date:</td>
                    <td><input type="text" name="delivDate" value="<?php echo date("d-M-Y");?>" class="txtdate2" /></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td id="subcontentf">Payment Terms:</td>
                    
                    <td colspan="3">
                    	<div id="paytermPlace">
                        	<select  id="payterm" name="payterm" onchange="javascript:AddDays(14)">
                            	
                                <option value="" selected="selected">::: Select :::</option>
                               	<?php foreach ($payterm as $payterm1){?>
                                        <option value="<?php echo $payterm1['days'];?>">
										<?php echo $payterm1['desc']. " "; if($payterm1['desc']!="COD"){echo "hari";}?></option>
                                    <?php }?>
                        		
                            </select>
                        </div>	
                    </td>
                    <td>
                    	<!--<a href onClick="window.open('<?php /*echo site_url('invoice/payAdd');*/?>','windowname','width =700,height=250, scrollbars=no')"><img src="<?php /* base_url();*/?>image_tinymce/add.jpg" id="refreshimg"/></a>-->
                        <!--<a href onClick="window.open('<?php /*echo site_url('invoice/payAdd');*/?>','windowname','width =700,height=250, scrollbars=no')"><img src="<?php /* base_url();*/?>image_tinymce/add.jpg" id="refreshimg"/></a>-->
                       	<img src="<?php echo base_url();?>image_tinymce/add.jpg" id="refreshimgX"/>
                    </td>
                    
                </tr>
                
                <tr>
                	<td id="subcontentf">Delivery Term:</td>
                    <td colspan="3"><input type="text" name="delivTerm"/></td>
                    <td></td>
                    <td></td>
                    <td id="subcontentf">Payment Method:</td>
                    <td colspan="3">
                    	<select name="paymethod">
                         	 <option value="Cash" selected="selected">Cash</option>
                            <option value="Transfer">Transfer</option>
                        	
                    	 </select>
                    </td>
                 </tr>
                 
                 <tr >
                 	<td colspan="12" valign="top" id="itemplace">
                    	<div id="itemshown" class="itemShowClass">
                    	<table id="itemShow">
                        	
                            <col width="50px" /><!--select-->
                            <col width="30px" /><!--sq-->
                            <col width="100px" /><!--kode-->
                            <col width="200px" /><!--desc-->
                            <col width="100px" /><!--up-->
                            <col width="30px" /><!--prd-->
                            <col width="120px" /><!--amt-->
                            <col width="30" /><!--disc-->
                            <col width="80px" /><!--totaldisc-->
                            <col width="20px" /><!--tax1-->
                            <col width="20px" /><!--tax2-->
                            <col width="110px" /><!--final-->
                            	<tr>
                                <td></td>
                                <td></td>
                                
                                
                                <td>Kode Barang</td>
                                <td>Deskripsi</td>
                                <td>Unit Price</td>
                                <td>Prd</td>
                                <td>Amount</td>
                                <td>Disc %</td>
                                <td>Disc Amt</td>
                                <td>Tax 1</td>
                                <td>Tax 2</td>
                                <td>Final Amt</td>
                                
                            	</tr>
                            
                            	 <tr id="baris_1">
                                	
                                	<!--<td><p><label for="p_scnts"><input type="text" id="p_scnt" size="20" name="p_scnt" value="" placeholder="Input Value" /></label></p></td>-->
                                   	<td><input type="button" value="Hapus" id="delrow_1" onclick="javascript:removetr(1)" /></td>

                                    <td><a href="#" id="pilihBarangApa">Select</a></td>
                                    
                                    
                                   	
                                    
                                    
                                    <td><input type="text" class="brgList" id="kodebrg_1" name="kodebrg_1"/><input type="text" class="brgList" id="kodebrgprt_1" name="kodebrgprt_1" style="display:none"/></td>
                                    
                                    <td><input type="text" class="brgList" id="descbrg_1" name="descbrg_1"/></td>
                                    <td><input type="text" class="brgList" style="text-align:right" id="hargabrg_1"  name="hargabrg_1" onkeyup="javascript:quantity(1)" size="11"/></td>
                                    <td><input type="text" class="brgList" id="q_1" name="q_1" size="3" onkeyup="javascript:quantity(1)"/></td>
                                   
                                    <td><input type="text" class="brgList" style="text-align:right" id="amount_1" disabled="disabled" size="11"/></td>
                                    <td><input type="text" class="brgList" id="disc_1" name="disc_1" onkeyup="javascript:hitungjmldisc(1)" size="4" value="0"/></td>
                                    <td><input type="text" class="brgList" id="jumlahdisc_1" onkeyup="javascript:hitungdisc(1)" size="5" value="0"/></td>
                                    <td width="3%"><input type="checkbox" class="brglist" id="tax1_1" name="tax1_1" onclick="javascript:quantity(1)"/><input type="text" class="brglist" id="jumtax1_1" name="jumtax1_1" style="display:none"/></td>
                                    <td width="3%"><input type="checkbox" class="brglist" id="tax2_1" name="tax2_1" onclick="javascript:quantity(1)"/><input type="text" class="brglist" id="jumtax2_1" name="jumtax2_1" style="display:none"/></td>
                                    <td><input type="text" class="brgList" style="text-align:right"  id="finalamt_1" disabled="disabled" size="12"/></td><input type="text" value="1" name="counter" id="counter" style="display:none"/>
                                </tr>
                               
                                
                              
                        </table>
                        </div>
                    </td>
                 </tr>   
                 
                 <tr>
                 	<td colspan="12">
                    	
                        <table width="100%">
                        	
                            <tr>
                           	 	<td></td><td></td><td></td><td></td></td><td></td><td></td>
                                <td id="subcontentf">Materai</td>
                                <td><input type="text"  name="materai" id="materai" value="6000.00" onkeyup="javascript:quantity(1)" style="text-align:right"/></td>
								
                                
                                
                            </tr>
                            
                            <tr>
                                <td><strong>Summary</strong></td>
                            </tr>
                            <tr>
                                <td id="subcontentf">Discount Total:</td>
                                <td><input type="text" disabled="disabled" id="discountTotal" name="discountTotal" value="0.00" style="text-align:right"/></td>
                                <td>Total Tax 1</td>
                                <td><input type="text" value="0.00" name="tax1total" id="tax1total"  style="text-align:right" disabled="disabled"/></td>
                                <td>Total Tax 2</td>
                                <td><input type="text" value="0.00" name="tax2total" id="tax2total"  style="text-align:right" disabled="disabled"/></td>
                                
                                <td id="subcontentf">Total:</td>
                                <td><input type="text" readonly id="subTotal" name="subTotal" style="text-align:right" placeholder="0.00"/></td>
                               
                            </tr>
                            <tr>
                                <td></td><td></td><td></td><td></td></td><td></td><td></td>
                                <td id="subcontentf">Bayar</td>
                                <td><input type="text"  name="deposit" id="deposit" name="deposit"  placeholder="0.00" style="text-align:right" onkeyup="javascript:kurangDeposit()"/></td>
                            </tr>
                         

                            <tr>
                           	 	<td></td><td></td><td></td><td></td></td><td></td><td></td>
                                <td id="subcontentf">Amt Due</td>
                                <td><input type="text"  name="totalAkhir" id="totalAkhir" disabled="disabled" value="0.00" style="text-align:right"/></td>
								
                                
                                
                            </tr>
                            
                            <tr>
                            	<td id="subcontentf" ></td>
                                <td><input type="text" value="0.00"  id="delivery" style="display:none"/></td>
                            	
                                <td id="subcontentf"></td>
                                <td><input type="text" disabled="disabled"  id="totalreal" name="totalreal" style="display:none" value="0.00"/></td>
                            </tr>
                            
                            <tr>
                                <td valign="top"><strong>Note:</strong></td>
                                <td colspan="11"> <textarea name="note" style="height:150px; resize:vertical; max-height:200px;">Periode : 1 <?php echo date("F Y");?> - 26 <?php echo date("F Y");?>

Driver : 
Payment not later than 

BCA KCU Menara Bidakara
A/C : 450 3077 879
A/N : PT Harpa Sekawan</textarea>
                            	</td>
                            </tr>
                        </table>
                 	</td>
                 </tr>
                    
        
        	
            </table>
          	
            
            <!--<div class="row">
            	<div class="col1">Penerimaan</div>
                <div class="col2"><input type="text" name="penerimaan" /> 
                	<div class="errorField"><?php /*echo form_error("penerimaan");*/?></div>
                </div>
			</div>-->
            <div id="hiddenGenerate"></div>
            <div class="title" align="right">
            	<input type="submit" name="btnSave" value="Save" class="button_red" /><input type="submit" name="btnGener" value="Generate Pdf and Save" class="button_red" onclick="javascript:updateNoInvo(this.form)" />
            </div>
            
       
            <div class="success" id="sukses"><?php echo (isset($success))?$success:"";?>&nbsp;</div>
            <div class="errorField"><?php echo form_error("mataUang");?></div>
            
        </form>
        
        </div>
          
        <?php /*================================================================*/
		// add payterm
		?>
        
        <div id="dialog-form" title="Tambah Data Payment Terms">
    	<p class="validateTips">Harus diisi semua</p>
 
            <form>
            <fieldset>
                <label for="name">Hari</label>
                <input type="text" name="name" id="name" class="text ui-widget-content ui-corner-all" />
                <label for="email">Deskripsi</label>
                <input type="text" name="email" id="email" value="" class="text ui-widget-content ui-corner-all" />
                
            </fieldset>
            </form>
        </div>
 		
        
        <div id="dialog-form-customer" title="Tambah Data Customer">
        	
            Perusahaan: <div id="headDialog1C" class="headdiag"></div>
    		<p class="validateTips-c">Harus diisi semua</p>
 
            <form>
            <fieldset>
            	<table width="100%">
                <tr>
                <td><label for="name-c">Nama</label></td>
                <td><input type="text" name="name-c" id="name-c" class="text ui-widget-content ui-corner-all" /></td>
                </tr>
                <tr>
                <td><label for="telp-c">No Telp</label></td>
                <td><input type="text" name="telp-c" id="telp-c" class="text ui-widget-content ui-corner-all" /></td>
                </tr>                
                <tr>
                <td><label for="fax-c">Fax</label></td>
                <td><input type="text" name="fax-c" id="fax-c"  class="text ui-widget-content ui-corner-all" /><td>
                </tr>
                <tr>
                <td><label for="alamat-c">Alamat</label></td>
                <td><input type="text" name="alamat-c" id="alamat-c"  class="text ui-widget-content ui-corner-all" /></td>
                </tr>
                <tr style="display:none">
                <td><label for="rt-c">RT</label></td>
                <td><input type="text" name="rt-c" id="rt-c"  class="text ui-widget-content ui-corner-all" /></td>
                </tr>
                 <tr style="display:none">
                <td><label for="rw-c">RW</label></td>
                <td><input type="text" name="rw-c" id="rw-c"  class="text ui-widget-content ui-corner-all" /></td>
                <tr>
                <td><label for="kode-c">Kode Pos</label></td>
                <td><input type="text" name="kode-c" id="kode-c"  class="text ui-widget-content ui-corner-all" /></td>
               	</tr>
                <td><label for="kota-c">Kota</label></td>
                <td><input type="text" name="kota-c" id="kota-c"  class="text ui-widget-content ui-corner-all" /></td>
                <tr>
                <td><label for="provinsi-c">Provinsi</label></td>
                <td><input type="text" name="provinsi-c" id="provinsi-c"  class="text ui-widget-content ui-corner-all" /></td>				 				</tr>
                </table>
            </fieldset>
            </form>
        </div>
         
       


		<?php /*================================================================*/
		// add delivery
		?>
     	<div id="dialog-form-deliv" title="Tambah Data Pengiriman">
        	Penambahan Untuk Customer: <div id="headDialog" class="headdiag"></div>
            Perusahaan: <div id="headDialog1" class="headdiag"></div>
    		<p class="validateTips-deliv">Harus diisi semua</p>
 
            <form>
            <fieldset>
            	<table width="100%">
                <tr>
                <td><label for="name-deliv">Nama</label></td>
                <td><input type="text" name="name-deliv" id="name-deliv" class="text ui-widget-content ui-corner-all" /></td>
                </tr>
                <tr>
                <td><label for="telp-deliv">No Telp</label></td>
                <td><input type="text" name="telp-deliv" id="telp-deliv" class="text ui-widget-content ui-corner-all" /></td>
                </tr>                
                <tr>
                <td><label for="fax-deliv">Fax</label></td>
                <td><input type="text" name="fax-deliv" id="fax-deliv"  class="text ui-widget-content ui-corner-all" /><td>
                </tr>
                <tr>
                <td><label for="alamat-deliv">Alamat</label></td>
                <td><input type="text" name="alamat-deliv" id="alamat-deliv"  class="text ui-widget-content ui-corner-all" /></td>
                </tr>
                <tr style="display:none">
                <td><label for="rt-deliv">RT</label></td>
                <td><input type="text" name="rt-deliv" id="rt-deliv"  class="text ui-widget-content ui-corner-all" /></td>
                </tr>
                                 <tr style="display:none">

                <td><label for="rw-deliv">RW</label></td>
                <td><input type="text" name="rw-deliv" id="rw-deliv"  class="text ui-widget-content ui-corner-all" /></td>
                <tr>
                <td><label for="kode-deliv">Kode Pos</label></td>
                <td><input type="text" name="kode-deliv" id="kode-deliv"  class="text ui-widget-content ui-corner-all" /></td>
               	</tr>
                <td><label for="kota-deliv">Kota</label></td>
                <td><input type="text" name="kota-deliv" id="kota-deliv"  class="text ui-widget-content ui-corner-all" /></td>
                <tr>
                <td><label for="provinsi-deliv">Provinsi</label></td>
                <td><input type="text" name="provinsi-deliv" id="provinsi-deliv"  class="text ui-widget-content ui-corner-all" /></td>											  				</tr>
                </table>
            </fieldset>
            </form>
        </div>
 
         
      
		<?php /* =================================================*/
        // add bill?>
		
     	<div id="dialog-form-bill" title="Tambah Data Penagihan">
        	Penambahan Untuk Customer: <div id="headDialogBill" class="headdiag"></div>
            Perusahaan: <div id="headDialog1Bill" class="headdiag"></div>
    		<p class="validateTips-bill">Harus diisi semua</p>
 
            <form>
            <fieldset>
            	<table width="100%">
                <tr>
                <td><label for="name-bill">Nama</label></td>
                <td><input type="text" name="name-bill" id="name-bill" class="text ui-widget-content ui-corner-all" /></td>
                </tr>
                <tr>
                <td><label for="telp-bill">No Telp</label></td>
                <td><input type="text" name="telp-bill" id="telp-bill" class="text ui-widget-content ui-corner-all" /></td>
                </tr>                
                <tr>
                <td><label for="fax-bill">Fax</label></td>
                <td><input type="text" name="fax-bill" id="fax-bill"  class="text ui-widget-content ui-corner-all" /><td>
                </tr>
                <tr>
                <td><label for="alamat-bill">Alamat</label></td>
                <td><input type="text" name="alamat-bill" id="alamat-bill"  class="text ui-widget-content ui-corner-all" /></td>
                </tr>
                <tr style="display:none">
                <td><label for="rt-bill">RT</label></td>
                <td><input type="text" name="rt-bill" id="rt-bill"  class="text ui-widget-content ui-corner-all" /></td>
                </tr>
                                 <tr style="display:none">

                <td><label for="rw-bill">RW</label></td>
                <td><input type="text" name="rw-bill" id="rw-bill"  class="text ui-widget-content ui-corner-all" /></td>
                <tr>
                <td><label for="kode-bill">Kode Pos</label></td>
                <td><input type="text" name="kode-bill" id="kode-bill"  class="text ui-widget-content ui-corner-all" /></td>
               	</tr>
                <td><label for="kota-bill">Kota</label></td>
                <td><input type="text" name="kota-bill" id="kota-bill"  class="text ui-widget-content ui-corner-all" /></td>
                <tr>
                <td><label for="provinsi-bill">Provinsi</label></td>
                <td><input type="text" name="provinsi-bill" id="provinsi-bill"  class="text ui-widget-content ui-corner-all" /></td>				 				</tr>
                </table>
            </fieldset>
            </form>
        </div>
 
         
      
		<?php /* =================================================*/?>
        
        
        
    </div>
</div>
<?php /* =================================================*/
        // add bill?>
		
     	<div id="dialog-form-sales" title="Tambah Data Sales Person">
        	Penambahan Sales Person
    		<p class="validateTips-sales">Harus diisi semua</p>
 
            <form>
            <fieldset>
            	<table width="100%">
                <tr>
                <td><label for="usernameL">Username</label></td>
                <td><input type="text" name="username" id="username" class="text ui-widget-content ui-corner-all" /></td>
                </tr>
                <tr>
                <td><label for="passwordL">Password</label></td>
                <td><input type="text" name="password" id="password" class="text ui-widget-content ui-corner-all" /></td>
                </tr>                
                <tr>
                <td><label for="nameL">Name</label></td>
                <td><input type="text" name="name" id="name"  class="text ui-widget-content ui-corner-all" /><td>
                </tr>
                <tr>
                <td><label for="emailL">Email</label></td>
                <td><input type="text" name="email" id="email"  class="text ui-widget-content ui-corner-all" /></td>
                </tr>
                <tr>
                <td><label for="PhoneL">Phone</label></td>
                <td><input type="text" name="phone" id="phone"  class="text ui-widget-content ui-corner-all" /></td>
                </tr>
                                 <tr>

                <td><label for="addressL">Address</label></td>
                <td><textarea name="address" id="address"><?php echo set_value('address'); ?></textarea></td>
                </tr>
                </table>
            </fieldset>
            </form>
        </div>
 
         <?php /* =================================================*/
        // add barang?>
		
     	

         
       
		<?php /* =================================================*/?>
       
		<?php /* =================================================*/?>
<?php $this->load->view("general/footer");?>